/*
* @Author: zhenghao01
* @Date:   2021-08-18 16:59:51
* @Last Modified by:   zhenghao01
* @Last Modified time: 2021-08-18 17:53:13
*/
const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
module.exports={
	mode:'production',
	entry:'./src/index.js',
	resolve:{
		extensions:['.js','.scss'],
		alias:{
          	style:path.resolve(__dirname,'./src/style/')
	    }
	},
	output:{
		filename:'bundle.js',
		path:path.resolve(__dirname,'dist')
	},
	module:{
		rules:[
			{
				test:/\.scss$/,
				use:[MiniCssExtractPlugin.loader,'css-loader','sass-loader']
			}
		]
	},
	plugins:[
		new MiniCssExtractPlugin({
			filename:'style/[name].css'
		}),
		new HtmlWebpackPlugin({
			template:'./public/index.html',
			title:'插件的使用',
			inject:'body',
			hash:true
		})
	]
}